<?php
$release_date = $publication->getReleaseDate();
$year = substr($release_date,0,4);
$month = substr($release_date,5,2);
$day = substr($release_date,8,2);
$f_release_date = $day."/".$month."/".$year;
?>
<form action="<?php echo url_for('@publications_edit_save') ?>" method="post" enctype="multipart/form-data" autocomplete="off">
    <input type="hidden" name="hdId" value="<?php echo $publication->getId(); ?>" />
<h1>Editar publicación "<?php echo $publication->getTitle(); ?>"</h1>
<table width="100%" cellpadding="5" cellspacing="5">
  <tr>
    <td>T&iacute;tulo</td>
    <td><textarea name="title"><?php echo $publication->getTitle(); ?></textarea></td>
  </tr>
  <tr>
    <td>Autor</td>
    <td><input type="text" name="author" value="<?php echo $publication->getAuthor(); ?>" /></td>
  </tr>
  <tr>
    <td>Fecha de publicaci&oacute;n</td>
    <td>
        <input type="text" id="release_date" name="release_date" value="<?php echo $f_release_date; ?>" placeholder="25/12/2000" autocomplete="off" />
    </td>
  </tr>
  <tr>
    <td>Tipo de publicaci&oacute;n</td>
    <td>
        <select name="type">
            <option value="">-- Seleccione tipo de publicaci&oacute;n --</option>
            <?php foreach($publications_types as $publications_type){ ?>
            <option value="<?php echo $publications_type->getId(); ?>"
            <?php if($publications_type->getId()==$publication->getPublicationsTypeId()){ echo "selected"; } ?>>
                <?php echo $publications_type->getDescription(); ?></option>
            <?php } ?>
        </select>
    </td>
  </tr>
  <tr>
    <td>Imagen de la portada</td>
    <td>
        <?php $DS = DIRECTORY_SEPARATOR; ?>
        <?php if(file_exists(sfConfig::get('sf_upload_dir').$DS."publications".$DS.$publication->getId().".jpg")){ ?>
            <?php echo image_tag('/uploads/publications/'.$publication->getId().'.jpg','size=245x306') ?>
            <br />
        <?php } ?>
        <input type="file" name="image" />
    </td>
    <td><em style="color: gray;">La imagen debe ser: 245x306 JPG</em></td>
  </tr>
  <tr>
    <td colspan="2" align="center">
      <input type="submit" value="Guardar Cambios"/>
    </td>
  </tr>
</table>
</form>